from po.loginPage import login_page
import time
import pytest
from common.utils import Utils

def test_login(driver,username:str='byhy',password:str='sdfsdf'):
    driver.get('http://127.0.0.1:8234')
    l_obj = login_page(driver)
    l_obj.login(username,password)
    time.sleep(0.5)
    assert driver.title != '登录'

@pytest.mark.parametrize('username,password,result',Utils.get_csv(r'data/login_data.csv'))
def test_login2(driver,username:str,password:str,result:str):
    driver.get('http://127.0.0.1:8234')
    l_obj = login_page(driver)
    l_obj.login(username,password)
    time.sleep(0.5)
    # assert driver.title == '登录'
    text = driver.switch_to.alert.text
    assert text == result